home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 114_01.zip / ED7.BDS < prev    next >
Text File  |  1993-06-01  |  3KB  |  191 lines

  1. /* Screen editor:  prompt line module
  2.  *
  3.  * Source:  ed7.cc
  4.  * Version: May 15, 1981.
  5.  */
  6.  
  7. /* define globals */
  8.  
  9. #include ed.h
  10. #include bdscio.h
  11. #include ed1.ccc
  12. #include edext.cc
  13.  
  14. /* globals used by this module -----
  15.  
  16. char pmtln[MAXLEN];        mode
  17. char pmtfn[SYSFNMAX];        file name
  18.  
  19. ----- */
  20.  
  21. /* put error message on prompt line.
  22.  * wait for response.
  23.  */
  24.  
  25. pmtmess(s1,s2) char *s1, *s2;
  26. {
  27. int x,y;
  28.     /* save cursor */
  29.     x=outgetx();
  30.     y=outgety();
  31.     outxy(0,0);
  32.     /* make sure line is correct */
  33.     outdelln();
  34.     pmtline1();
  35.     pmtcol1(x);
  36.     /* output error message */
  37.     fmtsout(s1,outgetx());
  38.     fmtsout(s2,outgetx());
  39.     /* wait for input from console */
  40.     syscin();
  41.     /* redraw prompt line */
  42.     pmtline1();
  43.     pmtcol1(x);
  44.     pmtfile1(pmtfn);
  45.     pmtmode1(pmtln);
  46.     /* restore cursor */
  47.     outxy(x,y);
  48. }
  49.  
  50. /* write new mode message on prompt line */
  51.  
  52. pmtmode(s) char *s;
  53. {
  54. int x,y;        /* save cursor on entry */
  55.     /* save cursor */
  56.     x=outgetx();
  57.     y=outgety();
  58.     /* redraw whole line */
  59.     outxy(0,0);
  60.     outdelln();
  61.     pmtline1();
  62.     pmtcol1(x);
  63.     pmtfile1(pmtfn);
  64.     pmtmode1(s);
  65.     /* restore cursor */
  66.     outxy(x,y);
  67. }
  68.  
  69. /* update file name on prompt line */
  70.  
  71. pmtfile(s) char *s;
  72. {
  73. int x, y;
  74.     /* save cursor */
  75.     x=outgetx();
  76.     y=outgety();
  77.     /* update whole line */
  78.     outxy(0,0);
  79.     outdelln();
  80.     pmtline1();
  81.     pmtcol1();
  82.     pmtfile1(s);
  83.     pmtmode1(pmtln);
  84.     /* restore cursor */
  85.     outxy(x,y);
  86. }
  87.  
  88. /* change mode on prompt line to edit: */
  89.  
  90. pmtedit()
  91. {
  92.     pmtmode("edit:");
  93. }
  94.  
  95. /* update line and column numbers on prompt line */
  96.  
  97. pmtline()
  98. {
  99. int x,y;
  100.     /* save cursor */
  101.     x=outgetx();
  102.     y=outgety();
  103.     /* redraw whole line */
  104.     outxy(0,0);
  105.     outdelln();
  106.     pmtline1();
  107.     pmtcol1(x);
  108.     pmtfile1(pmtfn);
  109.     pmtmode1(pmtln);
  110.     /* restore cursor */
  111.     outxy(x,y);
  112. }
  113.  
  114. /* update just the column number on prompt line */
  115.  
  116. pmtcol()
  117. {
  118. int x,y;
  119.     /* save cursor */
  120.     x=outgetx();
  121.     y=outgety();
  122.     /* update column number */
  123.     pmtcol1(x);
  124.     /* update cursor */
  125.     outxy(x,y);
  126. }
  127.  
  128. /* update mode.  call getcmnd() to write on prompt line */
  129.  
  130. pmtcmnd(mode,buffer) char *mode, *buffer;
  131. {
  132. int x,y;
  133.     /* save cursor */
  134.     x=outgetx();
  135.     y=outgety();
  136.     pmtmode1(mode);
  137.     /* user types command on prompt line */
  138.     getcmnd(buffer,outgetx());
  139.     /* restore cursor */
  140. }
  141.  
  142. /* update and print mode */
  143.  
  144. pmtmode1(s) char *s;
  145. {
  146. int i;
  147.     outxy(40,0);
  148.     fmtsout(s,40);
  149.     i=0;
  150.     while (pmtln[i++]=*s++) {
  151.         ;
  152.     }
  153. }
  154.  
  155. /* print the file name on the prompt line */
  156.  
  157. pmtfile1(s) char *s;
  158. {
  159. int i;
  160.     outxy(25,0);
  161.     if (*s==EOS) {
  162.         fmtsout("no file",25);
  163.     }
  164.     else {
  165.         fmtsout(s,25);
  166.     }
  167.     i=0;
  168.     while (pmtfn[i++]=*s++) {
  169.         ;
  170.     }
  171. }
  172.  
  173. /* print the line number on the prompt line */
  174.  
  175. pmtline1()
  176. {
  177.     outxy(0,0);
  178.     fmtsout("line: ",0);
  179.     putdec(bufln(),5);
  180. }
  181.  
  182.  
  183. /* print column number of the cursor */
  184.  
  185. pmtcol1(x) int x;
  186. {
  187.     outxy(12,0);
  188.     fmtsout("column: ",12);
  189.     putdec(x,3);
  190. }
  191.